﻿Namespace Controls

    Public Class InfoControl
        Inherits RichTextBox

        Public Sub New()
            MyBase.New()
            MyBase.ScrollBars = RichTextBoxScrollBars.Vertical
        End Sub

        Public Sub ShowInfo(ByVal msg As String)
            MyBase.AppendText(msg)
            MyBase.AppendText(Environment.NewLine)
            MyBase.ScrollToCaret()
        End Sub

        Public Sub ShowError(ByVal msg As String)
            Dim startPos As Integer = MyBase.Text.Length
            MyBase.SelectionStart = MyBase.Text.Length
            MyBase.AppendText(msg)
            Dim endPos As Integer = MyBase.Text.Length
            MyBase.Select(startPos, endPos - startPos)
            MyBase.SelectionColor = Color.Red
            MyBase.AppendText(Environment.NewLine)
            MyBase.ScrollToCaret()
        End Sub

    End Class

End Namespace
